﻿Imports System.ComponentModel

Namespace Controls
    ''' <summary> 
    ''' 下拉列表选项转换器 
    ''' </summary> 
    Public Class CanBeNullControlsConverter
        Inherits StringConverter
        ''' <summary> 
        ''' 构造函数 
        ''' </summary> 
        Public Sub New()
        End Sub

        ''' <summary> 
        ''' 下拉列表编辑属性 
        ''' </summary> 
        ''' <param name="context"></param> 
        ''' <returns></returns> 
        Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As ITypeDescriptorContext) As Boolean
            Return True
        End Function

        ''' <summary> 
        ''' 获取标准值列表 
        ''' </summary> 
        ''' <param name="context"></param> 
        ''' <returns></returns> 
        Public Overloads Overrides Function GetStandardValues(ByVal context As ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
            Dim controlsArray As New ArrayList()
            controlsArray.Add("可为空")
            controlsArray.Add("必填")

            Return New StandardValuesCollection(controlsArray)

        End Function

        ''' <summary> 
        ''' return ture的话只能选,return flase可选可填 
        ''' </summary> 
        ''' <param name="context"></param> 
        ''' <returns></returns> 
        Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As ITypeDescriptorContext) As Boolean
            Return False
        End Function
    End Class
End Namespace